package com.zhoug.common3.content;

import android.app.Service;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;

/**
 * @Author 35574
 * @Date 2022/4/14
 * @Description
 */
public class SimpleServiceConnection<S extends Service,B extends SimpleBinder<S>> implements ServiceConnection {
    private S mServer;

    @Override
    public void onServiceConnected(ComponentName name, IBinder service) {
        try {
            mServer=((B) service).getService();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onServiceDisconnected(ComponentName name) {
        mServer=null;
    }

    public S getServer() {
        return mServer;
    }



}
